﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.BLL;

public partial class Partners_delete : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int pid = int.Parse(Request["PId"]);           
            try
            {
                PartnerBLL bll = new PartnerBLL();
                int res = bll.DeletePartnerById(pid);
                if (res > 0)
                    ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除成功!'),document.location='Default.aspx?page=" + Request["page"] + "'", true);                
                else
                    ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除失败,请重试!'),document.location='Default.aspx?page=" + Request["page"] + "'", true);
            }
            catch (Exception ex)
            {

                LogYuMin.LogWriter.GetWriter(LogYuMin.LogFile.error).Write(GetType(), "DeletePartner", LogYuMin.LogStates.ERROR, ex);
                ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除失败!')", true);
            }
        }
    }
}